<%var csstpl = {%>

    <%};%>
        <%var jstpl = {%>
            <script>
                var app = new Vue({
                    el: "#content",
                    data: {
                        query: {
                            name: '',
                            phone: '',
                            pageNumber: 1,
                            pageSize: 10,
                            content: '',
                        },
                        data_result: {},
                        feedback: '',
                    },
                    created: function() {
                        this.loadPage("init")
                            // 在这试试
                        let form = layui.form;
                        form.render();
                    },
                    mounted() {
                        let form = layui.form;
                        let that = this;
                        form.on('submit(feedbackSubmit)', function(data) {
                            console.log(data.field);
                            Ajax('/system/feedback/reply', data.field, function(res) {
                                if (res.state) {
                                    gx.alert(res.msg);
                                    that.loadPage('init');
                                    $("#feedbackModal").modal('hide');
                                } else {
                                    gx.alert(res.msg);
                                }
                            })
                        })
                    },
                    methods: {
                        loadPage: function(model) { //载入模式有两种  init初始化载入 load分页载入
                            if (model == "init") {
                                this.query.pageNumber = 1;
                            }
                            Ajax("/system/feedback", this.query, function(d) {
                                console.log(d);
                                app.data_result = d.list;
                                if (d.firstPage == true) {
                                    layui.laypage.render({
                                        elem: 'gexin_page' //注意，这里的 test1 是 ID，不用加 # 号
                                            ,
                                        layout: ['count', 'prev', 'page', 'next',
                                            'limit', 'skip'
                                        ],
                                        count: d.totalRow //数据总数，从服务端得到
                                            ,
                                        limit: app.query.pageSize,
                                        jump: function(obj, first) {
                                            app.query.pageNumber = obj.curr;
                                            if (app.query.pageSize != obj.limit) {
                                                app.query.pageSize = obj.limit;
                                                app.loadPage("init");
                                                return;
                                            }
                                            if (!first) {
                                                app.loadPage("load");
                                            }
                                        }
                                    });
                                }
                            })
                        },
                        reply: function(data) {
                            let that = this;
                            that.feedback = data;
                            that.$nextTick(function() {
                                $("#feedbackModal").modal('show');
                            });
                        },
                        splitImg:function(imgs){
                            if(imgs){
                                return imgs.split(",");
                            }else{
                                return "";
                            }
                           
                        }
                    }
                })
            </script>
            <%};%>
                <%layout("../layout/_layout_layui.html",{title:"反馈列表",jstpl:jstpl,csstpl:csstpl}){%>
                    <div class="layui-row" id="content" v-cloak>
                        <div class="layui-col-md10">
                            <div class="layui-form-item ">
                                <div class="layui-input-inline">
                                    <input type="text" v-model="query.content" placeholder="输入反馈内容模糊查询" autocomplete="off" class="layui-input">
                                </div>
                                <!--  <div class="layui-input-inline">
                                    <input type="text" v-model="query.phone" placeholder="输入联系电话模糊查询" autocomplete="off" class="layui-input">
                                </div> -->
                            </div>
                        </div>

                        <div class="layui-col-md2">
                            <div class="layui-form-item">
                                <a @click="loadPage('init')" class="layui-btn"><i class="layui-icon">&#xe615;</i> 查询/筛选</a>
                            </div>
                        </div>
                        <div class="layui-col-md12" style="margin-top: 20px">
                            <table class="layui-table ">
                                <thead>
                                    <tr>
                                        <th>反馈图片</th>
                                        <th>反馈内容</th>
                                        <th>反馈时间</th>
                                        <th>反馈人</th>
                                        <!-- <th>回复内容</th>
                                        <th>操作</th> -->

                                    </tr>
                                </thead>
                                <tbody v-for="d in data_result">
                                    <tr>
                                        <td style="display: flex"><div style="margin: 0 2px 0 2px" v-for="img in splitImg(d.img_url)"><img style="height: 35px;" :src='img' ></div></td>
                                        <td>{{d.content}}</td>
                                        <td>{{d.create_time}}</td>
                                        <td>{{d.nickname}}</td>
                                        <!-- <td>{{d.reply}}</td>
                                        <td>-->
                                            <!-- <a class="layui-btn layui-btn-sm" @click="reply(d)">回复</a> -->
                                        <!-- </td> -->
                                    </tr>
                                </tbody>
                                <tbody id="tbody_body" v-if="data_result.length==0">
                                    <tr>
                                        <td colspan="13" style="text-align:center;height:300px">
                                            <h1>没有数据</h1>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                            <fieldset id="gexin_page" class="layui-elem-field layui-field-title"></fieldset>
                        </div>





                        <div class="modal fade" id="feedbackModal" tabindex="-1" role="dialog" aria-hidden="true">
                            <form id="auditForm" class="layui-form form-horizontal ">
                                <div class="modal-dialog">
                                    <div class="modal-content">
                                        <div class="modal-header">
                                            <h4 class="modal-title">
                                                反馈回复
                                            </h4>
                                        </div>
                                        <div class="modal-body">
                                            <!-- 弹出框开始  -->
                                            <div class="layui-row layui-col-space15">
                                                <!-- 弹出框开始  -->
                                                <input type="hidden" id="feedback.id" v-model="feedback.id" name="feedback.id">
                                                <div class="layui-form-item">
                                                    <label class="layui-form-label">回复内容</label>
                                                    <div class="layui-input-block">
                                                        <input class="layui-input" type="text" name="feedback.reply" lay-verify="required" placeholder="请输入内容">
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="modal-footer">
                                            <div class="layui-form-item">
                                                <div class="layui-input-block">
                                                    <button type="button" class="layui-btn" lay-submit lay-filter="feedbackSubmit">提交</button>
                                                    <button type="button" data-dismiss="modal" class="layui-btn layui-btn-primary">关闭</button>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </form>
                        </div>



                    </div>
                    <%};%>